{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 Courier;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww11620\viewh15340\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

\f0\fs24 \cf0 FFTW is a C library for FFT\
\
Installed FFTW version 3 following their instructions (./configure; make; make install). Places library files in /usr/local/lib. \
\
Relevant doc: \
- http://www.fftw.org/fftw3_doc/Complex-One_002dDimensional-DFTs.html#Complex-One_002dDimensional-DFTs\
- http://www.fftw.org/fftw3_doc/One_002dDimensional-DFTs-of-Real-Data.html#One_002dDimensional-DFTs-of-Real-Data\
- http://www.acm.org/crossroads/xrds4-2/jni.html\
- http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/functions.html\
- http://cnd.netbeans.org/docs/jni/nb6-linux/beginning-jni-linux.html\
- http://developer.apple.com/Mac/library/documentation/Java/Conceptual/Java14Development/05-CoreJavaAPIs/CoreJavaAPIs.html\
\
To see gcc's default include path: \
\pard\pardeftab720\ql\qnatural

\f1 \cf0 echo | gcc -v -x c -E -\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

\f0 \cf0 \
Had to change Java version from 1.6 back to 1.5. \
\
\
1. Created class FFTW with a native method that will call FFTW C code. \
\
2. Created header file ffttest_FFTW.h in src: \
Jaymie:~ jaymie$ cd /Users/jaymie/NetBeansProjects/ffttest/src \
Jaymie:src jaymie$ javah -classpath ../build/classes -jni ffttest.FFTW\
\
3. Created implementation file ffttest_FFTW.c in src and made it call FFTW C code. \
\
4. Compiled dynamic library: \
Jaymie:src jaymie$ cc -c -I/System/Library/Frameworks/JavaVM.framework/Headers -o ffttest_FFTW.o ffttest_FFTW.c\
Jaymie:src jaymie$ cc -dynamiclib -L/usr/local/lib -lfftw3 -o libfftwWrapper.dylib ffttest_FFTW.o -framework JavaVM\
\
5. Moved dynamic library to working directory of ffttest project (/Users/jaymie/NetBeansProjects/ffttest). \
\
\
I'm baffled by the results I'm getting from FFT and would appreciate any help. \
\
I'm using FFTW 3.2.2 but have gotten similar results with other FFT implementations (in Java). When I take the FFT of a sine wave, the scaling of the result depends on the frequency (Hz) of the wave--specifically, whether it's close to a whole number or not. The resulting values are scaled really small when the frequency is near a whole number, and they're orders of magnitude larger when the frequency is in between whole numbers. (See graph.) Is this right?? \
\
I checked that the inverse FFT of the FFT is equal to the original sine wave times the number of samples, and it is. The shape of the FFT also seems to be correct. \
\
It wouldn't be so bad if I were analyzing individual sine waves, because I could just look for the spike in the FFT regardless of its height. The problem is that I want to analyze sums of sine waves. If I'm analyzing a sum of sine waves at, say, 440 Hz and 523.25 Hz, then only the spike for the one at 523.25 Hz shows up. The spike for the other is so tiny that it just looks like noise. There must be some way to make this work because in Matlab it does work-- I get similar-sized spikes at both frequencies. How can I change the code below to make this work? \
\
}